package com.example.robertluozizhao.java.test.kotlin.suspend

import android.util.Log
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext

/**
 * <pre>
 *     author: luozz@anjiu-tech.com
 *     time  : 2020/12/4
 *     desc  :
 * </pre>
 */
class TestSuspend {

    companion object{
        val INSTANCE:TestSuspend by lazy {
            TestSuspend()
        }
    }
    
    suspend fun getMember():MutableList<String> = withContext(Dispatchers.IO){
        Log.d("CoroutineTestActivity", "getMember: 2.....thread:${Thread.currentThread().name}")
            val mutableListOf = mutableListOf("123", "456")
        mutableListOf
        delay(2000)
        Log.d("CoroutineTestActivity", "getMember: 3......")
        return@withContext mutableListOf
    }
    
}